package com.spring.utils;

public class Assert {

    public static String processingRequestPath(String processingRequestPath){
        if (isBlank(processingRequestPath)) {
            return "";
        }
        if (processingRequestPath.lastIndexOf("/") != 0){
            return ("/" + processingRequestPath).trim();
        }
        return processingRequestPath;
    }

    /**
     * 判断字符串是否为空
     * @param cs 传入的字符串
     * @return
     */
    public static boolean isNotBlank(final CharSequence cs) {
        return !isBlank(cs);
    }

    public static boolean isBlank(final CharSequence cs) {
        int strLen;
        if (cs == null || (strLen = cs.length()) == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if (Character.isWhitespace(cs.charAt(i)) == false) {
                return false;
            }
        }
        return true;
    }

    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }


}
